@priis In the first example you forgot to close the file. The with clause in the second example is doing that for you. So no need to close there. P.S.: When you enclose your code in lines with three backticks (```), then it is printed as such.